﻿package view.message
{
    import com.core.*;
    import com.core.display.*;
    import com.sh.game.global.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import morn.core.handlers.*;

    public class Fcmalert extends Chenmi1UI
    {
        private var callBack:Function;
        private var args:Object;
        private var _text:TextField;
        private var _text2:TextField;
        private var _line:Bitmap;
        private var _model:Boolean = false;
        private var _autoclose:int = 0;
        private var _intvalid:uint = 0;
        private var _btns:Array;
        public static var CLOSE:int = 99;
        private static var _parent:DisplayObjectContainer;
        private static var alert:Fcmalert;

        public function Fcmalert()
        {
            return;
        }// end function

        private function initView() : void
        {
            btn_sure.clickHandler = new Handler(this.clickHandler);
            btn_leave.clickHandler = new Handler(this.clickHandler2);
            btn_close.clickHandler = new Handler(this.clickHandler3);
            return;
        }// end function

        private function clickHandler3() : void
        {
            this.visible = false;
            return;
        }// end function

        protected function clickHandler() : void
        {
            ModelProxy.change("plugin", "open", {target:"fcm", point:new Point(GlobalLayer.instance.root.stageWidth / 2, GlobalLayer.instance.root.stageHeight / 2), top:new Point(GlobalLayer.instance.root.stageWidth / 2 - 350, 100)});
            this.visible = false;
            return;
        }// end function

        protected function clickHandler2() : void
        {
            this.visible = false;
            return;
        }// end function

        public static function init(param1:Object) : void
        {
            _parent = DisplayObjectContainer(param1);
            return;
        }// end function

        public static function show(param1:int) : Fcmalert
        {
            if (alert == null)
            {
                alert = new Fcmalert;
                _parent.addChild(alert);
                alert.initView();
                alert.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
                alert.addEventListener(MouseEvent.MOUSE_UP, mouseDown);
            }
            if (param1 == 2)
            {
                alert.txt_desc.text = "对不起，您已在线超过5小时，即将处于收益为0状态！请点击下方按钮进行防沉迷认证。";
            }
            else
            {
                alert.txt_desc.text = "对不起，您已在线超过3小时，即将处于收益减半状态！请点击下方按钮进行防沉迷认证。";
            }
            alert.x = _parent.stage.stageWidth / 2 - alert.width / 2;
            alert.y = _parent.stage.stageHeight / 2 - alert.height / 2;
            alert.visible = true;
            return alert;
        }// end function

        static function mouseDown(event:MouseEvent) : void
        {
            event.stopImmediatePropagation();
            return;
        }// end function

    }
}
